package org.yourscrum.web;

privileged aspect ThemeController_Roo_Controller {
    
    @org.springframework.web.bind.annotation.RequestMapping(value = "/theme", method = org.springframework.web.bind.annotation.RequestMethod.POST)    
    public java.lang.String ThemeController.create(@org.springframework.web.bind.annotation.ModelAttribute("theme") org.yourscrum.domain.Theme theme, org.springframework.validation.BindingResult result) {    
        if (theme == null) throw new IllegalArgumentException("A theme is required");        
        for(javax.validation.ConstraintViolation<org.yourscrum.domain.Theme> constraint : javax.validation.Validation.buildDefaultValidatorFactory().getValidator().validate(theme)) {        
            result.rejectValue(constraint.getPropertyPath(), null, constraint.getMessage());            
        }        
        if (result.hasErrors()) {        
            return "theme/create";            
        }        
        theme.persist();        
        return "redirect:/theme/" + theme.getId();        
    }    
    
    @org.springframework.web.bind.annotation.RequestMapping(value = "/theme/form", method = org.springframework.web.bind.annotation.RequestMethod.GET)    
    public java.lang.String ThemeController.createForm(org.springframework.ui.ModelMap modelMap) {    
        modelMap.addAttribute("theme", new org.yourscrum.domain.Theme());        
        modelMap.addAttribute("projects", org.yourscrum.domain.Project.findAllProjects());        
        modelMap.addAttribute("stories", org.yourscrum.domain.Story.findAllStories());        
        return "theme/create";        
    }    
    
    @org.springframework.web.bind.annotation.RequestMapping(value = "/theme/{id}", method = org.springframework.web.bind.annotation.RequestMethod.GET)    
    public java.lang.String ThemeController.show(@org.springframework.web.bind.annotation.PathVariable("id") Long id, org.springframework.ui.ModelMap modelMap) {    
        if (id == null) throw new IllegalArgumentException("An Identifier is required");        
        modelMap.addAttribute("theme", org.yourscrum.domain.Theme.findTheme(id));        
        return "theme/show";        
    }    
    
    @org.springframework.web.bind.annotation.RequestMapping(value = "/theme", method = org.springframework.web.bind.annotation.RequestMethod.GET)    
    public java.lang.String ThemeController.list(org.springframework.ui.ModelMap modelMap) {    
        modelMap.addAttribute("themes", org.yourscrum.domain.Theme.findAllThemes());        
        return "theme/list";        
    }    
    
    @org.springframework.web.bind.annotation.RequestMapping(method = org.springframework.web.bind.annotation.RequestMethod.PUT)    
    public java.lang.String ThemeController.update(@org.springframework.web.bind.annotation.ModelAttribute("theme") org.yourscrum.domain.Theme theme, org.springframework.validation.BindingResult result) {    
        if (theme == null) throw new IllegalArgumentException("A theme is required");        
        for(javax.validation.ConstraintViolation<org.yourscrum.domain.Theme> constraint : javax.validation.Validation.buildDefaultValidatorFactory().getValidator().validate(theme)) {        
            result.rejectValue(constraint.getPropertyPath(), null, constraint.getMessage());            
        }        
        if (result.hasErrors()) {        
            return "theme/update";            
        }        
        theme.merge();        
        return "redirect:/theme/" + theme.getId();        
    }    
    
    @org.springframework.web.bind.annotation.RequestMapping(value = "/theme/{id}/form", method = org.springframework.web.bind.annotation.RequestMethod.GET)    
    public java.lang.String ThemeController.updateForm(@org.springframework.web.bind.annotation.PathVariable("id") java.lang.Long id, org.springframework.ui.ModelMap modelMap) {    
        if (id == null) throw new IllegalArgumentException("An Identifier is required");        
        modelMap.addAttribute("theme", org.yourscrum.domain.Theme.findTheme(id));        
        modelMap.addAttribute("projects", org.yourscrum.domain.Project.findAllProjects());        
        modelMap.addAttribute("stories", org.yourscrum.domain.Story.findAllStories());        
        return "theme/update";        
    }    
    
    @org.springframework.web.bind.annotation.RequestMapping(value = "/theme/{id}", method = org.springframework.web.bind.annotation.RequestMethod.DELETE)    
    public java.lang.String ThemeController.delete(@org.springframework.web.bind.annotation.PathVariable("id") java.lang.Long id) {    
        if (id == null) throw new IllegalArgumentException("An Identifier is required");        
        org.yourscrum.domain.Theme.findTheme(id).remove();        
        return "redirect:/theme";        
    }    
    
}
